<template>
  <el-row :gutter="10" class="panel-group">
    <el-col :xs="16" :sm="8" :md="4" :lg="4" class="card-panel-col">
      <router-link to="/user/profile">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-user2">
            <svg-icon icon-class="user2" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text2">
              个人中心
            </div>
            快捷进入
          </div>
        </div>
      </router-link>
    </el-col>
    <el-col :xs="16" :sm="8" :md="4" :lg="4" class="card-panel-col">
      <router-link to="/user/messageCenter">
        <div class="card-panel">
          <div class="card-panel-icon-wrapper icon-message">
            <svg-icon icon-class="message" class-name="card-panel-icon" />
          </div>
          <div class="card-panel-description">
            <div class="card-panel-text2">
              消息中心
            </div>
            快捷进入
          </div>
        </div>
      </router-link>
    </el-col>
    <el-col :xs="16" :sm="8" :md="4" :lg="4" class="card-panel-col">
      <div class="card-panel" @click="handleLogout">
        <div class="card-panel-icon-wrapper icon-logout">
          <svg-icon icon-class="logout" class-name="card-panel-icon" />
        </div>
        <div class="card-panel-description">
          <div class="card-panel-text2">
            退出登录
          </div>
          快捷进入
        </div>
      </div>
    </el-col>
  </el-row>
</template>

<script>
import { permission } from '@/directive/permission/index'

export default {
  directives: { permission },
  methods: {
    async handleLogout() {
      await this.$store.dispatch('user/logout')
      this.$router.push(`/login?redirect=${this.$route.fullPath}`)
    }
  }
}
</script>

<style lang="scss" scoped>
.panel-group {
  margin-top: 18px;
  .card-panel-col{
    margin-bottom: 32px;
  }
  .card-panel {
    height: 108px;
    cursor: pointer;
    font-size: 12px;
    position: relative;
    overflow: hidden;
    color: #666;
    background: #fff;
    box-shadow: 4px 4px 40px rgba(0, 0, 0, .05);
    border-color: rgba(0, 0, 0, .05);
    &:hover {
      .card-panel-icon-wrapper {
        color: #fff;
      }
      .icon-user2 {
         background: #40c9c6;
      }
      .icon-message {
        background: #36a3f7;
      }
      .icon-lock {
        background: #f4516c;
      }
      .icon-logout {
        background: #34bfa3
      }
    }
    .icon-user2 {
      color: #40c9c6;
    }
    .icon-message {
      color: #36a3f7;
    }
    .icon-lock {
      color: #f4516c;
    }
    .icon-logout {
      color: #34bfa3
    }
    .card-panel-icon-wrapper {
      float: left;
      margin: 14px 0 0 14px;
      padding: 16px;
      transition: all 0.38s ease-out;
      border-radius: 6px;
    }
    .card-panel-icon {
      float: left;
      font-size: 48px;
    }
    .card-panel-description {
      float: right;
      font-weight: bold;
      margin: 26px;
      margin-left: 0px;
      .card-panel-text {
        line-height: 18px;
        color: rgba(0, 0, 0, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-text2 {
        line-height: 18px;
        color: rgba(0, 79, 248, 0.45);
        font-size: 16px;
        margin-bottom: 12px;
      }
      .card-panel-num {
        font-size: 20px;
      }
    }
  }
}
</style>
